<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"	exclude-result-prefixes="php">

    <xsl:include href="utility.xsl" />
    <xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes" />
    <xsl:variable name="TIMESTAMP" select="php:functionString('time')" />
    <xsl:variable name="DOMAIN">http://melative.com</xsl:variable>

	<xsl:template match="/response">
        <div class="kronos">
            <xsl:apply-templates select="fp" />
        </div>
    </xsl:template>
    
    <xsl:template match="fp">
    <xsl:if test="title !=''"><h3><xsl:value-of select="title" /></h3></xsl:if>
    <!--<div class="i">
        <xsl:element name="img">
            <xsl:attribute name="src">http://gravatar.com/avatar/<xsl:value-of select="user/name" />?s=48</xsl:attribute>
            <xsl:attribute name="alt"><xsl:value-of select="user/name" /></xsl:attribute>
        </xsl:element>
    </div>-->
    <div class="c">
        <p><xsl:value-of disable-output-escaping="yes" select="php:functionString('mela_kron_text',content)" /></p>
        <div class="meta"><xsl:call-template name="meta-section" /></div>
    </div>
    </xsl:template>
    
    <xsl:template name="meta-section"><span class="source">
        <xsl:if test="source != '' and source != 'web'">
        from 
        <xsl:value-of select="source" disable-output-escaping="yes" />
        <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="action">
        on
        <xsl:element name="a">
			<xsl:attribute name="href"><xsl:value-of select="$DOMAIN" />/<xsl:value-of select="action/entity/type" />/<xsl:value-of select="translate(action/entity/name,' ','+')" /></xsl:attribute>
			<xsl:attribute name="rel">melative</xsl:attribute>
            <xsl:attribute name="class">kron-entity</xsl:attribute>
            <xsl:value-of select="action/entity/name" />
        </xsl:element>
        <xsl:text> </xsl:text>
        </xsl:if></span>
        <xsl:element name="a">
            <xsl:attribute name="href"><xsl:value-of select="$DOMAIN" />/<xsl:value-of select="user/name" />/<xsl:value-of select="id" /></xsl:attribute>
            <xsl:attribute name="class">utc utc-<xsl:value-of select="timestamp" /></xsl:attribute>
            <xsl:attribute name="title"><xsl:value-of select="created_at" /></xsl:attribute>
			<xsl:value-of select="php:functionString('date', 'D, j F Y', timestamp)" />
            <!--<xsl:call-template name="relative-time"><xsl:with-param name="diff"><xsl:value-of select="($TIMESTAMP - number(timestamp))" /></xsl:with-param></xsl:call-template>-->
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>
